import $ from '../common';
Page({
  data: {
    img:'https://sxzimgs.oss-cn-shanghai.aliyuncs.com/yingxiao/page/f91e5fe4-cf2e-11e7-9713-44032ca554a5.png',
    noimg:$.noImage,
    _components_modal_hide:true
  },
  onLoad(e) {
    this.setData({
      info:$.parent().data.info
    })
  },
  onShow() {

  },
  gochooseshool(e){
    const{idx}=e.currentTarget.dataset
    if(idx==2 && !this.data.info.campus_name){

      return
    }
    $.navigateTo('/address/chooseschool')
  },
  gochooseclass(){
    if(!this.data.info.campus_name){
      this.setData({
        istip:true,
        ner:'请先选择所在学校'
      })
      setTimeout(() => {
        this.setData({
          istip:false,
        })
      }, 2000);
      return
    }
    $.navigateTo(`/address/chooseclass?uuid=${this.data.info.campus_uuid}`)
  },
  godelete(){
    const{info}=this.data
    $.get('/campus/schoolclass/students/query',{
      name:info.name,
      schoolclass_uuid:info.schoolclass_uuid,
      campus_uuid:info.campus_uuid
    },res=>{
      this.setData({
        queryinfo:res.students
      })
    })
  },
  callphone(){
    wx.makePhoneCall({
      phoneNumber:'4007574711'
    })
  },
  goapprove(e){
    const{info}=e.currentTarget.dataset
    $.get('/user/student/certify',{
      campus_uuid:info.campus_uuid,
      student_uuid:info.student_uuid,
      userstudent_uuid:this.data.info.uuid,
    },res=>{
      this.setData({ _components_modal_hide:false})
    })
  },
  sumbit(){
    this.setData({ _components_modal_hide:true})
    $.parent(2).getinfo()
    wx.navigateBack({
      delta: 2,
    })
  }
})